﻿using System;

namespace StudentInfoManager
{
    public class Student
    {
        public Student()
        {
            Name = "";
            Email = "";
        }

        public Student(string name)
        {
            Name = name;
            Email = "";
        }

        public Student(string name, string email)
        {
            Name = name;
            Email = email;
        }
        public string Name { get; set; }
        public string Email { get; set; }

        public static Student Parse(string s)
        {
            int lt = s.IndexOf('<');
            int gt = s.IndexOf('>');

            Student student = new Student();
            student.Name = s.Substring(0, lt);
            student.Email = s.Substring(lt + 1, gt - lt - 1);

            return student;
        }

        public override string ToString()
        {
            return Name + "<" + Email + ">;";
        }
    }
}
